package com.chenju.javastatic.common.enums;


import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Component
public class EasyCode {
    public final static String URL_SPLIT;

    static {
        if (System.getProperty("os.name").toLowerCase().startsWith("win")){
            URL_SPLIT = "\\";
        } else {
            URL_SPLIT = "/";
        }
    }

    // 注解的类型
    public static final String CLASS_TYPE = "CLASS";
    public static final String METHOD_TYPE = "METHOD";
    public static final String FIELD_TYPE = "FIELD";

    // 调用类型
    public static final String CONTAIN_TYPE = "CON";
    public static final String INVOKEVITUAL_TYPE = "IVL";
    public static final String INVOKESTATIC_TYPE = "ISC";
    public static final String INVOKESPECIAL_TYPE = "ISL";
    public static final String INVOKEINTERFACE_TYPE = "IIE";
    public static final String INVOKEDYNAMIC_TYPE = "IDC";
    public static final String INVOKEIMPLEMENTS_TYPE = "IPS";
    public static final String INVOKEEXTENDS_TYPE = "IES";
    public static final String INVOKEOUTERCLASS_TYPE = "IOS";
    public static final String INTERFACED_TYPE = "IFD";
    public static final String ANNOTATED_TYPE = "ATD";
    public static final String FEIGNCALL_TYPE = "FNC";

    // 特殊注解
    // Controller/RestController
    public static final List<String> ANNOTATION_CONTROLLER_LIST = new ArrayList<>(2);
    static {
        ANNOTATION_CONTROLLER_LIST.add("org.springframework.web.bind.annotation.RestController");
        ANNOTATION_CONTROLLER_LIST.add("org.springframework.stereotype.Controller");
    }
    // Aspect
    public static final String ANNOTATION_ASPECT = "org.aspectj.lang.annotation.Aspect";
    // FeignClient
    public static final String ANNOTATION_FEIGNCLIENT = "org.springframework.cloud.openfeign.FeignClient";
    // Configuration
    public static final String ANNOTATION_CONFIGURATION = "org.springframework.context.annotation.Configuration";
    // RequestMapping
    public static final String ANNOTATION_REQUESTMAPPING = "org.springframework.web.bind.annotation.RequestMapping";
    // Mapping: Delete/Get/Patch/Post/Put
    public static final List<String> ANNOTATION_MAPPING_LIST = new ArrayList<>();
    static {
        ANNOTATION_MAPPING_LIST.add("org.springframework.web.bind.annotation.DeleteMapping");
        ANNOTATION_MAPPING_LIST.add("org.springframework.web.bind.annotation.GetMapping");
        ANNOTATION_MAPPING_LIST.add("org.springframework.web.bind.annotation.PatchMapping");
        ANNOTATION_MAPPING_LIST.add("org.springframework.web.bind.annotation.PostMapping");
        ANNOTATION_MAPPING_LIST.add("org.springframework.web.bind.annotation.PutMapping");
    }

    public static List<String> springBeanAnnotationList = new ArrayList<>();
    static {
        springBeanAnnotationList.add("org.springframework.stereotype.Component");
        springBeanAnnotationList.add("org.springframework.stereotype.Service");
        springBeanAnnotationList.add("org.springframework.stereotype.Controller");
        springBeanAnnotationList.add("org.springframework.web.bind.annotation.RestController");
        springBeanAnnotationList.add("org.springframework.stereotype.Repository");
        springBeanAnnotationList.add("org.springframework.context.annotation.Configuration");
    }

    public static String aspectAnnotation;
    static {
        aspectAnnotation = "org.aspectj.lang.annotation.Aspect";
    }

    public static List<String> adviceAnnotationList = new ArrayList<>();
    static {
        adviceAnnotationList.add("org.aspectj.lang.annotation.Before");
        adviceAnnotationList.add("org.aspectj.lang.annotation.After");
        adviceAnnotationList.add("org.aspectj.lang.annotation.Pointcut");
    }

    public static enum DiffType {
        ADD,
        MODIFY,
        DELETE;

        private DiffType() {
        }
    }
}
